<template>
    <van-nav-bar title="物流详情" left-text="" left-arrow @click-left="goBack" />
    <section class="aui-flexView">
        <!-- 订单详细 -->
        <section class="aui-scrollView">
            <!-- 订单状态 -->
            <div class="aui-pay-change">
                <div class="aui-flex">
                    <div class="aui-flex-box">
                        <h3>{{ info.status_text }}</h3>
                    </div>
                    <div class="aui-pay-zfb">
                        <img src="/assets/images/icon-zfb.png" alt="" />
                    </div>
                </div>
            </div>

            <!-- 物流信息 -->
            <van-steps direction="vertical" :active="0">
                <van-step v-for="(item,index) in expresslist" :key="index">
                    <h3>{{ item.status }}</h3>
                    <p>{{ item.time }}</p>
                </van-step>
            </van-steps>
        </section>
    </section>
</template>
<script setup>
const { proxy } = getCurrentInstance()
const LoginUser = reactive(proxy.$cookies.get('LoginUser'));
const goBack = () => {
    proxy.$router.push('/order/index')
}
const orderid = ref(proxy.$route.query.orderid ?? 0)
const info = ref({
    address: {}
})
const expresslist = ref([])
onBeforeMount(() => {
    getOrderInfoData()
    getExpressData()
})
const getOrderInfoData = async () => {
    let result = await Api.OrderInfo({
        busid: LoginUser.id,
        orderid: orderid.value
    })
    if (result.code == 1) {
        info.value = result.data
    }
}

const getExpressData = async() =>{
    let result = await Api.OrderExpress({
        busid: LoginUser.id,
        orderid: orderid.value
    })
    if (result.code == 1) {
        expresslist.value = result.data
    }
}
</script>
<style>
@import url('/assets/css/info.css');
</style>